package com.polymorphic;

public class Testpy {
    public static void main(String[] args) {
        Cat c = new Cat();//猫就是一只猫
        Animal a = new Cat();//当前的动物是一只猫
        a.eat();
    }
}
class Animal{
    public  void  eat(){
        System.out.println("动物吃饭");
    }
        }
        class Cat extends Animal{
            @Override
            public void eat() {
                System.out.println("猫吃鱼");
            }
        }